//
//  HZJSmallTableViewCell.m
//  HZ_Beautiful_Music
//
//  Created by dllo on 16/4/5.
//  Copyright © 2016年 ui. All rights reserved.
//

#import "HZJSmallTableViewCell.h"

@interface HZJSmallTableViewCell ()

@property (nonatomic, strong) UIButton *playButton;
@property (nonatomic, strong) UILabel *allLable;
//@property (nonatomic, strong) UILabel *smountLable;

@property (nonatomic, strong) UILabel *managerLable;
@property (nonatomic, strong) UIImageView *managerImage;
@property (nonatomic, strong) UILabel *guanliLable;

@end

@implementation HZJSmallTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.playButton = [UIButton buttonWithType:UIButtonTypeSystem];
        [_playButton setImage:[UIImage imageNamed:@"Jbofang"] forState:UIControlStateNormal];
        [_playButton addTarget:self action:@selector(playButtonAction) forControlEvents:UIControlEventTouchDragInside];
        [self.contentView addSubview:_playButton];
        
        self.allLable = [[UILabel alloc] initWithFrame:CGRectZero];
        [self.contentView addSubview:_allLable];
        
        self.smountLable = [[UILabel alloc] initWithFrame:CGRectZero];
        [self.contentView addSubview:_smountLable];
        
        
        self.managerLable = [[UILabel alloc] initWithFrame:CGRectZero];
        [self.contentView addSubview:_managerLable];
        _managerLable.userInteractionEnabled = YES;
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction)];
        tap.numberOfTapsRequired = 1;
        [_managerLable addGestureRecognizer:tap];
        
        self.managerImage = [[UIImageView alloc] initWithFrame:CGRectZero];
        _managerImage.image = [UIImage imageNamed:@"Jmanage"];
        [self.managerLable addSubview:_managerImage];
        
        self.guanliLable = [[UILabel alloc] initWithFrame:CGRectZero];
        [self.managerLable addSubview:_guanliLable];
        
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.playButton.frame = CGRectMake(10, 10, self.bounds.size.height - 20, self.bounds.size.height - 20);
    self.allLable.frame = CGRectMake(20 + _playButton.bounds.size.width, 20, 100, 20);
    _allLable.text = @"播放全部";
    self.smountLable.frame = CGRectMake(_allLable.frame.origin.x, 50, 30, 15);
    _smountLable.font = [UIFont systemFontOfSize:14];
    _smountLable.textColor = [UIColor colorWithRed:190 / 255.0 green:190 / 255.0 blue:190 / 255.0 alpha:1];
    [_smountLable sizeToFit];
    
    self.managerLable.frame = CGRectMake(self.bounds.size.width - 100, 0, 100, self.bounds.size.height);
    self.managerImage.frame = CGRectMake(10, self.bounds.size.height /  2 - 10, 20, 20);
    self.guanliLable.frame = CGRectMake(35, _managerImage.frame.origin.y, 40, 20);
    _guanliLable.text = @"管理";
    _guanliLable.font = [UIFont systemFontOfSize:16];
    _guanliLable.textColor = [UIColor redColor];
  
}

#pragma mark - 播放按钮点击事件
- (void)playButtonAction {
    NSLog(@"这是播放全部按钮");
}

#pragma mark - 管理的点击事件
- (void)tapAction {
    NSLog(@"管理");
    [self.delegate MusicDownLoad];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
